//
//  MTRoundView.m
//  ShiShiBang
//
//  Created by 宋宝强 on 16/9/22.
//  Copyright © 2016年 motianjituan. All rights reserved.
//

#import "MTRoundView.h"

@implementation MTRoundView

- (void)awakeFromNib {
    
    //开启上下文
    UIGraphicsBeginImageContextWithOptions(self.image.size, NO, 0.0);
    //画圆：正切于上下文
    UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, self.image.size.width, self.image.size.height)];
    //设为裁剪区域
    [path addClip];
    //画图片
    [self.image drawAtPoint:CGPointZero];
    //生成一个新的图片
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    // 关闭上下文
    UIGraphicsEndImageContext();
    
    self.image = newImage;
}


@end
